package 面试.遍历算法.String类型题目;

public class 统计自定字符串出现次数 {
    public static void main(String[] args) {
        String key="ab";  String str="acbdabfehaabdeab";
        String[] strings = str.split(key,-1);
        System.out.println(key + "出现了" + (strings.length-1) + "次");
    }
}
